app.controller('serch',function($http,$scope,$ionicLoading,$stateParams){
	$ionicLoading.show()
    console.log($stateParams)
	$http.get('/api/v2/products',{
		params:{
			"q":$stateParams.id,
			"offset":0,
			"limit":10
		}
	}).then(function(res){
		if(res){
			$ionicLoading.hide()
		}
		console.log(res)
		$scope.serchs=res.data
		$scope.len = $scope.serchs.length
	}).catch(function(err){
		$ionicLoading.show({
			duration:3000,
			template:'暂无商品信息'
		})
	})
	$http.get('/api/v2/articles',{
		params:{
			"type":"news",
			"q":$stateParams.id,
			"offset":0,
			"limit":8
		}
	}).then(function(res){
		if(res){
			$ionicLoading.hide()
		}
		console.log(res)
		$scope.serch=res.data
		$scope.lens = $scope.serch.length
	}).catch(function(err){
		$ionicLoading.show({
			duration:3000,
			template:'暂无商品信息'
		})
	})
})